const { Model, DataTypes } = require("sequelize");
const sequelize = require("../app/database");

class Product extends Model {}

Product.init(
  {
    id: {
      type: DataTypes.INTEGER,
      primaryKey: true,
      allowNull: false,
      autoIncrement: true,
    },
    product_name: {
      type: DataTypes.STRING,
      allowNull: false,
      unique: true,
    },
    product_price: {
      type: DataTypes.INTEGER,
      allowNull: false,
    },
    product_image: {
      type: DataTypes.STRING,
      allowNull: false,
    },
    product_summary: {
      type: DataTypes.STRING,
      allowNull: false,
    },
    product_type: {
      type: DataTypes.STRING,
    },
    product_reads: {
      type: DataTypes.INTEGER,
    },
    // product_likes: {
    //   type: DataTypes.INTEGER,
    // },
    createAt: {
      type: DataTypes.DATE,
    },
    updateAt: {
      type: DataTypes.DATE,
    },
  },
  {
    tableName: "product",
    createdAt: "createAt",
    updatedAt: "updateAt",
    timestamps: true,
    sequelize,
  }
);
module.exports = Product;
